package the.broccoli.uc.vo;

import org.springframework.context.i18n.LocaleContextHolder;
import the.broccoli.ac.entity.Res;

import java.io.Serializable;
import java.util.Locale;

public class ActionVO implements Serializable {
    private boolean auth;
    private String name;
    private String code;

    public ActionVO() {}
    public ActionVO(boolean auth, Res res) {
        this.auth = auth;
        this.code = res.getResCode();

        Locale locale = LocaleContextHolder.getLocale();
        String lang = locale.getLanguage();
        if (Locale.US.getLanguage().equals(lang)) {
            this.name = res.getNameUs();
        } else {
            this.name = res.getNameCn();
        }
    }

    public boolean isAuth() {
        return auth;
    }

    public void setAuth(boolean auth) {
        this.auth = auth;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}
